//2009/08/14 21:21:55
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <sstream>
#include <algorithm>

using namespace std;

class EqualSubstrings
{
public:
    vector <string> getSubstrings(string str)
    {
		vector<string> ret;
        for (int i=str.size(); i>=0; i--)
        {
            string x = str.substr(0,i);
            string y = str.substr(i,str.size()-i);
			if(count('a',x) == count('b', y))
			{
				ret.push_back(x);
				ret.push_back(y);
				return ret;
			}
        }
    }
private:
    int count(char m, string x)
    {
		int total = 0;
		for(int i=0; i<x.size(); i++)
		{
			if(x[i] == m) total ++;
		}
		return total;
    }
};
